85a5ef4b4824c7dbfc0de188dbebfaeb937ced29,src/org/opendedup/sdfs/filestore/cloud/BatchJCloudChunkStore.java,BatchJCloudChunkStore,uploadFile,#File#String#String#,963
Before Change
blobStore.putBlob(this.name, b);
if (this.accessStore || this.atmosStore)
this.updateObject(pth, null, metaData);
this.checkoutFile(pth);
} catch (Exception e1) {
throw new IOException(e1);
After Change
Blob b = blobStore.blobBuilder(pth).payload(pth).contentLength(pth.length()).userMetadata(metaData)
.build();
if (this.accessStore || this.atmosStore) {
this.updateObject(pth, null, metaData);
b = blobStore.blobBuilder(pth).payload(pth).contentLength(pth.length()).build();
}
blobStore.putBlob(this.name, b);
if (this.accessStore || this.atmosStore)
this.updateObject(pth, null, metaData);
this.checkoutFile(pth);
} catch (Exception e1) {
throw new IOException(e1);
}
} else if (isDir) {
try {
HashMap<String, String> metaData = FileUtils.getFileMetaData(f, Main.chunkStoreEncryptionEnabled);
metaData.put("encrypt", Boolean.toString(Main.chunkStoreEncryptionEnabled));
metaData.put("lastmodified", Long.toString(f.lastModified()));
metaData.put("directory", "true");
Blob b = blobStore.blobBuilder(pth).payload(pth).contentLength(pth.length()).userMetadata(metaData)
.build();
if (this.accessStore || this.atmosStore) {
this.updateObject(pth, null, metaData);
b = blobStore.blobBuilder(pth).payload(pth).contentLength(pth.length()).build();
}
blobStore.putBlob(this.name, b);
this.checkoutFile(pth);
} catch (Exception e1) {
throw new IOException(e1);
}
} else {
String rnd = RandomGUID.getGuid();
File p = new File(this.staged_sync_location, rnd);
File z = new File(this.staged_sync_location, rnd + ".z");
File e = new File(this.staged_sync_location, rnd + ".e");
while (z.exists()) {
rnd = RandomGUID.getGuid();
p = new File(this.staged_sync_location, rnd);
z = new File(this.staged_sync_location, rnd + ".z");
e = new File(this.staged_sync_location, rnd + ".e");
}
try {
BufferedInputStream is = new BufferedInputStream(new FileInputStream(f));
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(p));
IOUtils.copy(is, os);
os.flush();
os.close();
is.close();
if (Main.compress) {
CompressionUtils.compressFile(p, z);
p.delete();
p = z;
}
if (Main.chunkStoreEncryptionEnabled) {
try {
EncryptUtils.encryptFile(p, e);
} catch (Exception e1) {
throw new IOException(e1);
}
p.delete();
p = e;
}
while (to.startsWith(File.separator))
to = to.substring(1);
FilePayload fp = new FilePayload(p);
HashCode hc = com.google.common.io.Files.hash(p, Hashing.md5());
HashMap<String, String> metaData = FileUtils.getFileMetaData(f, Main.chunkStoreEncryptionEnabled);
metaData.put("lz4compress", Boolean.toString(Main.compress));
metaData.put("md5sum", BaseEncoding.base64().encode(hc.asBytes()));
metaData.put("encrypt", Boolean.toString(Main.chunkStoreEncryptionEnabled));
metaData.put("lastmodified", Long.toString(f.lastModified()));
Blob b = blobStore.blobBuilder(pth).payload(fp).contentLength(p.length()).userMetadata(metaData)
.build();
if (this.accessStore || this.atmosStore) {
this.updateObject(pth, null, metaData);
b = blobStore.blobBuilder(pth).payload(fp).contentLength(p.length()).build();
}
if (this.azureStore)